#include <copydir.h>

int main()
{
	int i;
	char path1[D_SIZE],path2[D_SIZE];
	struct file_rate filerate;
	while(1) {
		sleep(1);
		system("clear");
		printf("文件备份和同步\n");
		printf("1.A备份到B\n");
		printf("2.A同步到B\n");
		printf("3.AB同时同步\n");
		printf("4.退出\n");
		printf("选择功能\n");
		scanf("%d",&i);
		if(i == 4)
			break;
		printf("输入文件夹路径\n");
		printf("A:\n");
		scanf("%s",path1);
		printf("B:\n");
		scanf("%s",path2);
		struct file_rate filerate;
		filerate.num = 0;
		filerate.sum = 0;
		num_file(path1, &filerate);
		if(i == 1) {
			backup_directory(path1, path2, &filerate);
		} else if(i == 2) {
			oneway_syn(path1, path2, &filerate);
		} else if(i == 3) {
			twoway_syn(path1, path2, &filerate);
		}
	}
	
	return 0;
}
